<?php

class Setting_model extends MY_Model {

    public function __construct() {
	parent::__construct();
	$this->table = 'jg_setting';
    }
    
    public function find_by_key($key){
	$this->db->from($this->table);
	
	$this->db->where('key',$key);
	
        if(!($query = $this->db->get())){
            return false;
        }
        
        if(!($setting = $query->row_object())){
            return false;
        }
        
	return $setting->value;
    }
    
    public function update_by_key($key,$data){
        $this->db->where('key',$key);
        
        return $this->db->update($this->table,$data);
    }

}
